﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.PointCloud.Editing.CUiPOCEditPointCloudEnabler
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using Tecnomatix.Engineering;
using Tecnomatix.Engineering.PrivateImplementationDetails;


namespace DnProcessSimulateCommands.PointCloud.Editing;

internal class CUiPOCEditPointCloudEnabler : ITxCommandEnabler
{
  public bool Enable
  {
    get
    {
      return TxApplication.ActiveDocument.PlatformGlobalServicesProvider.IsDocumentLoaded() && this.IsSinglePointCloudSelected();
    }
  }

  private bool IsSinglePointCloudSelected()
  {
    ITxObject ifSingleSelection = CApPOCEditManagerApp.getSelectedIfSingleSelection();
    return ifSingleSelection is TxPointCloud && this.IsValidPointCloudForEdit(ifSingleSelection as TxPointCloud);
  }

  private bool IsValidPointCloudForEdit(TxPointCloud pointCloud)
  {
    bool flag = false;
    if (TxPointCloud.op_Inequality(pointCloud, (ITxObject) null))
    {
      flag = pointCloud.Visibility != 3;
      if (flag)
        flag = TxPointCloud.op_Inequality(pointCloud, (ITxObject) CApPOCEditManagerApp.PointCloudInEdit);
    }
    return flag;
  }
}
